package com.repast.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.repast.common.ServerResponse;
import com.repast.pojo.Admin;
import com.repast.pojo.RewardStaff;
import com.repast.service.IAdminService;
import com.repast.service.IRewardStaffService;

import net.sf.json.JSONObject;

@Controller
@RequestMapping("/reward/")
public class RewardController {

	@Autowired
	private IRewardStaffService rewardService;
	
	//0代表打赏成功,1017系统异常,打赏失败
	@RequestMapping("reward.do")
	@ResponseBody
	public ServerResponse rewardEmployee(String json){
		RewardStaff rewardStaff = new RewardStaff();
		JSONObject jsonStr = JSONObject.fromObject(json);
		rewardStaff.setOpenid(jsonStr.getString("openid"));
		rewardStaff.setAdminId(jsonStr.getInt("adminId"));
		rewardStaff.setRewardMoney(new Double(jsonStr.getString("rewardMoney")));
		return rewardService.rewardEmployee(rewardStaff);
	}
}
